/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 *
 * @author Vincenzo
 */
public class InitListner implements ServletContextListener{

    public void contextInitialized(ServletContextEvent arg0) {
       String connectionURL = arg0.getServletContext().getInitParameter("connectionURL");
    	String username = arg0.getServletContext().getInitParameter("username");
    	String password = arg0.getServletContext().getInitParameter("password");
        //VineryManager vm;
        LoginManager lm;
        try {
            Class.forName("com.mysql.jdbc.Driver");
           // vm = new VineryManager(connectionURL, username, password);
            lm = new LoginManager(connectionURL, username, password);
           // arg0.getServletContext().setAttribute("vinery-manager", vm);
            arg0.getServletContext().setAttribute("login-manager", lm);
        } catch (Exception ex) {
            Logger.getLogger(InitListner.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void contextDestroyed(ServletContextEvent sce) {
        
    }



}